package com.student.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result <T>{
	private Integer code;
	private String message;
	private T data;


	public static<T> Result<T> success(Integer code,String message){
		Result<T> result=new Result<T>();
		result.setCode(code);
		result.setMessage(message);
		return result;
	}
	public static<T> Result<T> success(Integer code,String message,T data){
		Result<T> result=new Result<T>();
		result.setCode(code);
		result.setMessage(message);
		result.setData(data);
		return result;
	}
	public static<T> Result<T> fail(Integer code,String message){
		Result<T> result=new Result<T>();
		result.setCode(code);
		result.setMessage(message);
		return result;
	}
	public static<T> Result<T> fail(Integer code,String message,T data){
		Result<T> result=new Result<T>();
		result.setCode(code);
		result.setMessage(message);
		result.setData(data);
		return result;
	}
}
